package com.au.bescene.activity;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.au.bescene.R;
import com.au.bescene.adapter.VenueListAdapter;

/**
 * Represents list of Venues.
 * @author Khaled
 *
 */
public class VenueList extends ListActivity {

	private String[] _venues;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.venuelist);

		_venues = new String[] { 
	        	getResources().getString(R.string.venuelist_bullys),
	        	getResources().getString(R.string.venuelist_flynns),
	        	getResources().getString(R.string.venuelist_madcow),
	        	getResources().getString(R.string.venuelist_monsoons),
	        	getResources().getString(R.string.venuelist_riverview),
	        	getResources().getString(R.string.venuelist_thebank),
	        	getResources().getString(R.string.venuelist_thebrewery),
	        	getResources().getString(R.string.venuelist_theconsortium),
	        	getResources().getString(R.string.venuelist_thewatermark)
	        	};
		
		VenueListAdapter adapter = new VenueListAdapter(this, _venues);
		setListAdapter(adapter);
		
	}
	
	/**
	 * Listens to click events for VenueList items.
	 */
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
	
		Intent intent = new Intent(VenueList.this, Venue.class);
		if(_venues != null)
			intent.putExtra("venuename", _venues[position]);
		startActivity(intent);
	}
}
